<?php      
     // array for JSON response
     $response = array();
     // check for required fields
     if (isset($_POST['comment_id']) && isset($_POST['user_id_zing']) && isset($_POST['description'])) {
	 //if (isset($_POST['data']) && is_array($_POST['data'])) {
		//foreach ($_POST['data'] as $row => $data) {
			//$Comment_Id = $data[0];
			//$User_Id = $data[1];
			//$Detail_Comment = $data[2];
		//}
			$Comment_Id = $_POST['comment_id'];
			$User_Id_Zing = $_POST['user_id_zing'];
			$Detail_Comment = $_POST['description'];
		
         // include db connect class
         require_once __DIR__ . '/db_connect.php';
      
         // connecting to db
         $db = new DB_CONNECT();
		$query = "INSERT INTO dbzigo.sub_comment(comment_id, user_id_zing,description,time_sub_comment) "
					."VALUES('".$Comment_Id."', '".$User_Id_Zing."','".$Detail_Comment."', NOW())";
         // mysql inserting a new row
         $result = mysql_query($query);
      
         // check if row inserted or not
         if ($result) {
             // successfully inserted into database
             $response["success"] = 1;
			 $response["sub_comment_id"] = mysql_insert_id();
             $response["message"] = "Insert successfully created 1.";
      
             // echoing JSON response
             echo json_encode($response);
         } else {
             // failed to insert row
             $response["success"] = 0;
             $response["message"] = "Oops! An error occurred.";
      
             // echoing JSON response
             echo json_encode($response);
         }
     } else {
         // required field is missing
         $response["success"] = 0;
         $response["message"] = "Error value _POST";
         // echoing JSON response
         echo json_encode($response);
     }
 ?>